Skip to content

Add alternativeWebUrl param#956

Open
ibdafna wants to merge 3 commits into
coder:mainfrom
ibdafna:nflx/support-alternative-web-url
Open

Add alternativeWebUrl param#956
ibdafna wants to merge 3 commits into
coder:mainfrom
ibdafna:nflx/support-alternative-web-url

Conversation

@ibdafna
Copy link
Copy Markdown

@ibdafna ibdafna commented May 15, 2026

This PR adds a new parameter for specifying an alternative URL to use when opening Coder pages in the browser. When set, it replaces the connection URL for browser links only (dashboard, workspace pages, token authentication page). The connection URL is still used for API calls, SSH, and CLI operations. Useful when the Coder API runs on a port that browsers restrict (e.g., 7004) but the web UI is accessible on a standard port (e.g., 443)."

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9e8beed19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/webviews/chat/chatPanelProvider.ts Outdated
Comment on lines +159 to +162
const browserUrl = new URL(
resolved.pathname + resolved.search + resolved.hash,
browserBase,
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve path prefixes in chat navigation

When coder.alternativeWebUrl contains a path prefix (for example a reverse proxy at https://proxy.example.com/coder), constructing new URL(resolved.pathname..., browserBase) drops that prefix because the first argument starts with /; a chat navigation to /templates opens https://proxy.example.com/templates instead of https://proxy.example.com/coder/templates. Other browser links concatenate onto the resolved base and preserve such prefixes, so this makes chat links fail only for path-based alternative web URLs.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed!

Comment on lines +365 to +367
await vscode.env.openExternal(
vscode.Uri.parse(`${resolveBrowserUrl(url)}/cli-auth`),
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply alternative URL to OAuth login

This only switches the legacy token page to coder.alternativeWebUrl; when coder.experimental.oauth is enabled and the user chooses OAuth, loginWithOAuth still goes through OAuthAuthorizer.startAuthorization, which opens the discovered authorization URL directly. In deployments where the connection URL uses a browser-restricted/unreachable port and the web UI is available via the alternative URL, OAuth login still opens the restricted connection URL and cannot complete, while token login works.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't touch the OAuth path deliberately, but I think the case highlighted here is worth addressing so we have consistency. Will submit a fix shortly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed!

@EhabY EhabY self-assigned this May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants